package cn.edu.dao.impl;

import cn.edu.dao.CollectionDao;
import cn.edu.pojo.Book;
import cn.edu.pojo.Collection;

import java.util.List;

public class CollectionDaoImpl extends BaseDao implements CollectionDao {
    @Override
    public List<Collection> queryCollection(String sno) {
        String sql = "select sno,sn,date,label from collection where sno=? ";
        return queryForList(Collection.class,sql,sno);
    }

    @Override
    public int addCollection(Collection collection) {
        String sql = "insert into Collection(sno,sn,date,label) values(?,?,?,?)";
        return update(sql,collection.getSno(),collection.getSn(),collection.getDate(),collection.getLabel());
    }

    @Override
    public int deleteCollectionbySn(String sn) {
        String sql = "delete from Collection where sn=?";
        return update(sql,sn);
    }

//    @Override
//    public int upDateCollection(Collection collection) {
//        String sql = "update Collection set label=? where sn=?";
//        return update(sql,collection.getLabel(),collection.getSn());
//    }
}
